Function Reference

_SendMessage

Wrapper for commonly used Dll Call

#Include <misc.au3>
_SendMessage ( hWnd, msg [, wParam = 0 [, lParam = 0 [, return = 0 [, wParam Type = "int" [, lParam Type = "int" ]]]]] )

 

Parameters

hwnd window/control handle
msg message to send to control (number)
wParam Specifies additional message-specific information (Optional: Default 0)
lParam Specifies additional message-specific information (Optional: Default 0)
return what to return (Optional: Default 0)
wParam Type Specifies what type of additional information (Optional: Default "int")
lParam Type Specifies what type of additional information (Optional: Default "int")

 

Return Value

return = 0 thru 4 corresponds to the parameter of the _SendMessage Wrapper
return < 0 or > 4 returns array same as DllCall

 

Remarks

None

 

Related

DllCall

 

Example


#include <misc.au3>

_Main()

Func _Main()
    Local Const $Off = 2, $On = -1

    Opt("WinTitleMatchMode", 4)
    $hwnd = WinGetHandle('classname=Progman')
    _ToggleMonitor($hWnd, $Off)
    Sleep ( 3000 )
    _ToggleMonitor($hWnd, $On)
EndFunc

Func _ToggleMonitor($hwnd, $OnOff)
    Local Const $WM_SYSCOMMAND = 274
    Local Const $SC_MONITORPOWER = 61808
    _SendMessage($hWnd, $WM_SYSCOMMAND, $SC_MONITORPOWER, $OnOff)
    If @error Then
        MsgBox(0,"_ToggleMonitor", "_SendMessage Error: " & @error)
        Exit
    EndIf
EndFunc